const mysql = require("mysql")

let pool = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: '',
    database: 'history'
})


module.exports = {
    query: (sql) => {
        let p1 = new Promise((resolve, reject) => {
            pool.query(sql, (err, results, fiedls) => {
                if (err) {
                    console.log(err)
                } else {
                    resolve(results)
                }
            })
        })
        return p1

    }
}